-
Notifications
You must be signed in to change notification settings - Fork 3.6k
HHH-19396 cannot select the same column twice with different aliases while using cte #10158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
5126bf6
to
8b3f32e
Compare
Previous change was always setting |
…wice in same (sub)query
8b3f32e
to
38b7ede
Compare
hibernate-core/src/main/java/org/hibernate/query/sqm/internal/ConcreteSqmSelectQueryPlan.java
Outdated
Show resolved
Hide resolved
hibernate-core/src/main/java/org/hibernate/query/sqm/tuple/internal/AnonymousTupleType.java
Outdated
Show resolved
Hide resolved
hibernate-core/src/main/java/org/hibernate/query/sqm/tuple/internal/AnonymousTupleType.java
Outdated
Show resolved
Hide resolved
6a83ba0
to
9a986df
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Getting better @cigaly, there's still some things I'd like to address.
hibernate-core/src/main/java/org/hibernate/query/sqm/tuple/internal/AnonymousTupleType.java
Outdated
Show resolved
Hide resolved
hibernate-core/src/main/java/org/hibernate/query/sqm/tuple/internal/AnonymousTupleType.java
Outdated
Show resolved
Hide resolved
hibernate-core/src/main/java/org/hibernate/query/sqm/tuple/internal/AnonymousTupleType.java
Outdated
Show resolved
Hide resolved
9a986df
to
9429487
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Last comment, than this looks good IMO. Please also squash the changes after applying my suggestion, thanks.
hibernate-core/src/main/java/org/hibernate/query/sqm/tuple/internal/AnonymousTupleType.java
Outdated
Show resolved
Hide resolved
9429487
to
c1d91ce
Compare
…mporary tables and subqueries Selection items representing same column in (sub)query will be represented with single instance, this will hide real alias
c1d91ce
to
af39a76
Compare
Jira issue HHH-19396
When creating
SqlAstQueryPartProcessingStateImpl
in methodorg.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter#visitQuerySpec
parameterdeduplicateSelectionItems
must be set tofalse
(see comment in moved code block)When
selectStatement
contains same column more than once in methodorg.hibernate.query.sqm.tree.cte.SqmCteTable#createStatementTable
,SqmCteTable
constructor will be unable to properly resolve aliases. To prevent this alias in select clause selection should be used if exist, one from selectable node should be used otherwise.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license
and can be relicensed under the terms of the LGPL v2.1 license in the future at the maintainers' discretion.
For more information on licensing, please check here.
https://hibernate.atlassian.net/browse/HHH-19396